package ynu.edu.mapper;

import org.apache.ibatis.annotations.*;
import ynu.edu.po.Orders;

import java.util.List;

@Mapper
public interface OrdersMapper {

    @Insert("insert into orders values (null, #{userId}, #{businessId}, #{orderDate}, #{orderTotal}, #{daId}, 0)")
    @Options(useGeneratedKeys = true, keyProperty = "orderId", keyColumn = "orderId")
    public int saveOrders(Orders orders);
    public Orders getOrdersById(Integer orderId);
    public List<Orders> listOrdersByUserId(String userId);

    @Update("update orders set orderState=#{orderState} where orderId=#{orderId}")
    public int updateOrdersState(@Param("orderId") Integer orderId, @Param("orderState") Integer orderState);
}
